<extend name="Public/common"/>
<block name="othercss">
</block>
<block name="body">
<div class="mian" style="background-color: #f4f4f4">
    <div class="help">
        <div class="box">
            <div class="loc"><i class="icon iconloc"></i>您现在在这里：<a href="{:urlrotue('/')}">百宝库</a> > <a href="{:urlrotue('Member/index')}">个人中心</a> > <span class="on">交易订单</span>
            </div>
            <div class="clearfix help_list">
                <div class="right rightj1">
                    <div class="href-a">
                        <a href="{:urlrotue('Member/myorder')}"  <if condition="$status_mark eq 0">class="on"</if>>全部订单</a>
                    <a href="{:urlrotue('Member/myorder',Array('status_mark'=>1))}" <eq name="status_mark" value="1">class="on"</eq>>待付款</a>
                         <a href="{:urlrotue('Member/myorder',Array('status_mark'=>3))}" <eq name="status_mark" value="3">class="on"</eq>>待发货</a>
                         <a href="{:urlrotue('Member/myorder',Array('status_mark'=>4))}" <eq name="status_mark" value="4">class="on"</eq>>待收货</a>
                
                         <a href="{:urlrotue('Member/myorder',Array('status_mark'=>5))}" <eq name="status_mark" value="5">class="on"</eq>>已完成</a>
                         <a href="{:urlrotue('Member/myorder',Array('status_mark'=>6))}" <eq name="status_mark" value="6">class="on"</eq>>已取消</a>
                    </div>
                    <h2 class="title">交易订单</h2>
                    <div class="jypjSum">
                        <ul class="title clearfix">
                            <li class="j1">产品</li>
                            <li class="j2">数量</li>
                            <li class="j3">金额（元）</li>
                            <li class="j5">交易状态</li>
                            <li class="j4">交易操作 </li>
                            
                        </ul>
                        <ul class="jypj-table">
                        <empty name="list">{$empty}</empty>
                        <foreach name="list" item="item">
                            <li>
                                <div class="top clearfix"><a class="icon dustbin" style="display:none"></a>{$item.time_create|stringtime=1}&nbsp;&nbsp;&nbsp;订单编号:{$item.order_no}</div>
                                <table>
                                  <volist name="item.goods" id="vo">
                                    <tr>
                                    <td class="j1">
                                    <a class="clearfix" href="{:urlrotue('Goods/index',Array('id'=>$vo['goods_id']))}">
                                       <div class="lans">
                                       <div>{$vo.goods_name}</div> 
                                       <div class="spec">{$vo.goods_spec}</div>
                                     </div>  
                                   <div class="imgs"><img src="__ROOT__{$vo.goods_picture}" width="80" height="80"/> </div>
                                            </a>
                                                <div>
                                            <if condition="$item['status_pay'] eq 3">
                                   <a href="{:urlrotue('Member/shenqing_tuihuan',Array('id'=>$vo['id']))}" style="border:1px solid #999; width:80px; line-height:30px;display:inline-block">申请售后</a>
                                      </if>
                                    <if condition="$item['status_delivery'] eq 4">
                                            <a href="{:urlrotue('Member/comment_add',Array('id'=>$vo['id']))}" style="border:1px solid #999; width:80px; line-height:30px;display:inline-block">评价</a>
                                            </if>
                                            </div>
                                       
                                        </td>
                                        <td class="j2">{$vo.goods_num}</td>
                                        <td class="j3">{$vo['goods_price']*$vo['goods_num']|priceTofixed}</td>

                                        <if condition="$key eq 0">
                                            <td class="j4" rowspan="{$item.cart_num}">
                                            <p>{$item.status_str}</p>
                                             
                                        </td>
                                        </if>
                                    <if condition="$key eq 0">
                                        <td class="j5"  rowspan="{$item.cart_num}">
                                  
                                           
                             <if condition="($item.status_pay eq 1 OR $item.status_pay eq 2) AND ($item.pay_type eq 1) AND ($item.status eq 1 OR $item.status eq 2)">
                                <a href="{:U('Check/success',array('id'=>$item['order_id']))}" target="_blank" class="btn_pay">去付款</a>
                                
                                <a  onclick="confirm_4({$item.order_id})" class="btn_cancle">取消订单</a>
                                
                            </if>
                            <if condition="$item.status_delivery eq 2">
                                <a onclick="delivery_4({$item.order_id})" class="btn_sure">确认收货</a>
                            </if>
                            <a href="{:U('orderinfo',array('id'=>$item['order_id']))}" target="_blank" class="btn_see">订单详细</a>
                           
                                            
                                            
                                        </td>
                                        </if>
                                    
                                    </tr>
                                     </volist>
                                </table>
                            </li>
                          </foreach>
                        </ul>
                        <div class="pagetion">
                          {$page}
                        </div>
                    </div>
                </div>
                  <include file="Member:left_menu"/>
                
            </div>
            
        </div>
    </div>
</div>
</block>
<block name="otherjs">
 <script type="text/javascript">
               var url_delivery_4 = "{:urlrotue('order_delivery_4')}"; //确认到货
			   var url_confirm_4 = "{:urlrotue('order_confirm_4')}"; //取消订单
                function delivery_4(order_id) {   
					 layer.load(2, {time: 10*1000});
						 
                        $.getJSON(url_delivery_4, {order_id, order_id}, function(json){
                        if (json.status == 'success') {
							layer.msg("操作成功", {icon: 1});
                            document.location.reload();
                        } else {
						layer.msg("操作失败", {icon: 5});	
                        }
                        });
                }
				
       function confirm_4(order_id) {   
					
					 layer.confirm('确定取消该订单吗？', {
                      btn: ['是','不是'] //按钮
                       }, function(){
					   //layer.load(2, {time: 10*1000});
					   $.getJSON(url_confirm_4, {order_id, order_id}, function(json){
                        if (json.status == 'success') {
							//layer.msg("操作成功", {icon: 1});
                            document.location.reload();
                        } else {
						layer.msg("操作失败", {icon: 5});	
                        }
                        });
						 
  
                      }, function(){
                   
                       });
					   
					 
					 
                     
                }
    </script>

</block>

